{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "b2e6e21f",
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch\n",
    "from classifier import MistralForSequenceClassification\n",
    "from transformers.trainer_utils import get_last_checkpoint\n",
    "from transformers import AutoTokenizer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "55b90c1d",
   "metadata": {},
   "outputs": [],
   "source": [
    "MistralForSequenceClassification.register_for_auto_class()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "2660c0eb",
   "metadata": {},
   "outputs": [],
   "source": [
    "model = MistralForSequenceClassification.from_pretrained('mnli-mistral-191M-MLM')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "77f8d1e4",
   "metadata": {},
   "outputs": [],
   "source": [
    "tokenizer = AutoTokenizer.from_pretrained('mnli-mistral-191M-MLM')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "e097df7a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "CommitInfo(commit_url='https://huggingface.co/mesolitica/mnli-malaysian-mistral-191M-MLM-512/commit/246f8ef31ffe9d2f3cd5c22e652b55f72869708a', commit_message='Upload MistralForSequenceClassification', commit_description='', oid='246f8ef31ffe9d2f3cd5c22e652b55f72869708a', pr_url=None, pr_revision=None, pr_num=None)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.push_to_hub('mesolitica/mnli-malaysian-mistral-191M-MLM-512')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "bdc1bd4d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "CommitInfo(commit_url='https://huggingface.co/mesolitica/mnli-malaysian-mistral-191M-MLM-512/commit/4d31b356d951a97e865d1dad6e087c1d725d8baf', commit_message='Upload tokenizer', commit_description='', oid='4d31b356d951a97e865d1dad6e087c1d725d8baf', pr_url=None, pr_revision=None, pr_num=None)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tokenizer.push_to_hub('mesolitica/mnli-malaysian-mistral-191M-MLM-512')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0eca7d89",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
